from django.db import models
from django.utils.timezone import now


class OrderModel(models.Model):
    id = models.CharField(db_column="c_id", max_length=32, verbose_name=u"主键", primary_key=True, blank=False,
                          null=False)
    order_id = models.CharField(db_column="c_order_id", max_length=100, verbose_name="订单单号", blank=False, null=False)
    order_date = models.DateTimeField(db_column="c_order_date")
    main_id = models.CharField(db_column="c_main_id", max_length=32, verbose_name=u"主设备id", blank=True, null=True)
    custom_name = models.CharField(db_column="c_custom_name", max_length=100, verbose_name="客户名称", blank=True,
                                   null=True)
    custom_name_number = models.CharField(db_column="c_custom_name_number", max_length=100, verbose_name="客户编号",
                                          blank=True,
                                          null=True)
    custom_company_number = models.CharField(db_column="c_custom_company_number", max_length=100, verbose_name="客户公司编号",
                                             blank=True,
                                             null=True)
    custom_company = models.CharField(db_column="c_custom_company", max_length=100, verbose_name="客户公司名称", blank=True,
                                      null=True)
    custom_phone = models.CharField(db_column="c_custom_phone", max_length=100, verbose_name="客户公司电话", blank=True,
                                    null=True)
    is_delete = models.BooleanField(db_column="c_is_delete", default=False)
    create_date = models.DateTimeField(db_column="c_create_date", default=now)
    update_date = models.DateTimeField(db_column="c_update_date", default=now)

    class Meta:
        db_table = "t_order"
        verbose_name = "订单表"
        verbose_name_plural = verbose_name
        ordering = ["-order_date"]


